package tools;


public class DoubleVector extends Vector<Double> {

	public DoubleVector(int dim) {
		super(dim);
		list = new Double[dim];
		for(int i = 0; i < dim; i++) list[i] = new Double(0.0);
		mem.addDoubleSize(dim);
	}

	@Override
	public Vector<Double> copy() {
		Vector<Double> ret = new DoubleVector(dim);
		for(int i = 0; i < dim; i++){
			ret.set(i, list[i]);
		}
		return ret;
	}

	@Override
	public boolean isBigger(Vector<Double> other, int i) {
		return sum(i) <= other.sum(i);
	}

	@Override
	public boolean isSmaller(Vector<Double> other, int i) {
		return sum(i) <= other.sum(i);
	}

	@Override
	public Double sum(int i) {
		return sum(0, i);
	}

	@Override
	public Double sum(int i, int j) {
		double ret = 0;
		
		for(int k = i; k < j; k++) ret += list[k].doubleValue();
		
		return new Double(ret);
	}

	@Override
	protected Double define0() {
		return new Double(0);
	}

}
